<template>
    <el-dropdown @command="changeLanguage" trigger="click" class="ml20">
        <el-icon size="18">
            <svg-icon icon-class="language"></svg-icon>
        </el-icon>
        <template #dropdown>
            <el-dropdown-menu>
                <el-dropdown-item command="cn">中文</el-dropdown-item>
                <el-dropdown-item command="en">English</el-dropdown-item>
            </el-dropdown-menu>
        </template>
    </el-dropdown>
</template>

<script setup>
import SvgIcon from "@/components/SvgIcon/index.vue";
import {useI18n} from 'vue-i18n'

const {locale } = useI18n()
const changeLanguage = (language) => {
  localStorage.setItem('language', language)
    locale.value = language
}

</script>

<style scoped>

</style>